package com.netease.image.video;

import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.RectF;
import android.media.FaceDetector;
import android.media.FaceDetector.Face;
import android.os.Handler;

class h
  implements Runnable
{
  float a = 1.0F;
  Matrix b;
  FaceDetector.Face[] c = new FaceDetector.Face[3];
  int d;

  h(ActivityCropImage paramActivityCropImage)
  {
  }

  private void a()
  {
    ao localao = new ao(ActivityCropImage.c(this.e));
    int i = ActivityCropImage.b(this.e).getWidth();
    int j = ActivityCropImage.b(this.e).getHeight();
    Rect localRect = new Rect(0, 0, i, j);
    int k = (i - 152) / 2;
    int m = (j - 152) / 2;
    RectF localRectF = new RectF(k, m, k + 152, m + 152);
    localao.a(this.b, localRect, localRectF, ActivityCropImage.e(this.e));
    ActivityCropImage.c(this.e).a(localao);
  }

  private void a(FaceDetector.Face paramFace)
  {
    PointF localPointF = new PointF();
    int i = 2 * (int)(paramFace.eyesDistance() * this.a);
    paramFace.getMidPoint(localPointF);
    localPointF.x *= this.a;
    localPointF.y *= this.a;
    int j = (int)localPointF.x;
    int k = (int)localPointF.y;
    ao localao = new ao(ActivityCropImage.c(this.e));
    int m = ActivityCropImage.b(this.e).getWidth();
    int n = ActivityCropImage.b(this.e).getHeight();
    Rect localRect = new Rect(0, 0, m, n);
    int i1 = (m - 152) / 2;
    int i2 = (n - 152) / 2;
    RectF localRectF1 = new RectF(i1, i2, i1 + 152, i2 + 152);
    localao.a(this.b, localRect, localRectF1, ActivityCropImage.e(this.e));
    RectF localRectF2 = new RectF(j, k, j, k);
    localRectF2.inset(-i, -i);
    if (localRectF2.left < 0.0F)
      localRectF2.inset(-localRectF2.left, -localRectF2.left);
    if (localRectF2.top < 0.0F)
      localRectF2.inset(-localRectF2.top, -localRectF2.top);
    if (localRectF2.right > localRect.right)
      localRectF2.inset(localRectF2.right - localRect.right, localRectF2.right - localRect.right);
    if (localRectF2.bottom > localRect.bottom)
      localRectF2.inset(localRectF2.bottom - localRect.bottom, localRectF2.bottom - localRect.bottom);
    localao.a(this.b, localRect, localRectF2, false);
    ActivityCropImage.c(this.e).a(localao);
  }

  private Bitmap b()
  {
    if (ActivityCropImage.b(this.e) == null);
    Matrix localMatrix;
    for (Bitmap localBitmap = null; ; localBitmap = Bitmap.createBitmap(ActivityCropImage.b(this.e), 0, 0, ActivityCropImage.b(this.e).getWidth(), ActivityCropImage.b(this.e).getHeight(), localMatrix, true))
    {
      return localBitmap;
      if (ActivityCropImage.b(this.e).getWidth() > 256)
        this.a = (256.0F / ActivityCropImage.b(this.e).getWidth());
      localMatrix = new Matrix();
      localMatrix.setScale(this.a, this.a);
    }
  }

  public void run()
  {
    this.b = ActivityCropImage.c(this.e).getImageMatrix();
    Bitmap localBitmap = b();
    this.a = (1.0F / this.a);
    if (localBitmap != null)
      this.d = new FaceDetector(localBitmap.getWidth(), localBitmap.getHeight(), this.c.length).findFaces(localBitmap, this.c);
    if ((localBitmap != null) && (localBitmap != ActivityCropImage.b(this.e)))
      localBitmap.recycle();
    ActivityCropImage.d(this.e).post(new b(this));
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.image.video.h
 * JD-Core Version:    0.6.0
 */